<?php

namespace App\Http\Controllers;

use App\Services\InjectServices;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;

class IndexController extends Controller
{
    public function index()
    {
        $app = app();
        $routeSet = $app->routes->getRoutes();
        $routes = [];

        foreach ($routeSet as $route)
        {
            $namespace = $route->action['namespace'];
            if($namespace != 'App\Http\Controllers') {
                continue;
            }

            $routes[] = [
                'route' => $route->uri,
                'methods' => $route->methods,
                'middleware' => $route->computedMiddleware,
                'namespace'=>$route->action['namespace']
            ];
        }

        return view('index', compact('routes'));
    }
}
